#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024 ArchR (https://github.com/archr-linux/Arch-R)

. /etc/profile.d/001-functions

MYSLEEPMODE=$(get_setting system.suspendmode)
if [ -z "${MYSLEEPMODE}" ]
then
  /usr/bin/suspendmode mem
fi

# Handle lid key as a signal to shutdown
cat <<EOF >~/.config/logind.conf.d/login.conf
[Login]
HandlePowerKey=suspend
HandleLidSwitch=poweroff
EOF

